package com.lc.afbx.conn;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONObject;

/**
 * Created by Administrator on 2016/6/24.
 */
@HttpInlet(Conn.INLET_API_INSURANCE_COMPULSORY)
public class PostApiInsuranceInfo extends BaseAsyPost<PostApiInsuranceInfo.Info> {
    public String userid, cid, id_number, address, tel, plate_number, cartype, usenature,
            engine_number, vin, model_number, passengers, weight, displacement, power,
            vehicle_weight, taxpayer_number, insurance_type, warranty_type, regtime,
            Customer_Manager_number, dispatching, email, business_id, id_url, drive_url, name, nowfee, backfee, fine, premium, starttime, endtime;

    public PostApiInsuranceInfo(AsyCallBack<PostApiInsuranceInfo.Info> asyCallBack) {
        super(asyCallBack);
    }

    protected Info parser(JSONObject jsonObject) {

        TOAST = jsonObject.optString("message");

        if (jsonObject.optInt("code") == 200){

            Info info = new Info();
            info.code = jsonObject.optString("code");
            info.data = jsonObject.optString("data");
            info.message = jsonObject.optString("message");
            info.ordersn = jsonObject.optString("ordersn");

            return info;

        }

        return null;
    }

    public static class Info {

//        {"code":200,"message":"\u6210\u529f","data":"72","ordersn":"c201611115454485572"}
        public String message, code, data, ordersn;
    }

    @Override
    protected boolean skipSecret(String key) {


        return key.equals("id_url") || key.equals("drive_url");
    }
}
